<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <title>Edit Issue</title>
</head>
<body>
<div class="nav">
    <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}">Home</a></span>
    <span class="menuButton"><g:link class="list" action="list">Issue List</g:link></span>
    <span class="menuButton"><g:link class="create" action="create">New Issue</g:link></span>
</div>
<div class="body">
    <h1>Edit Issue</h1>
    <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${issue}">
        <div class="errors">
            <g:renderErrors bean="${issue}" as="list"/>
        </div>
    </g:hasErrors>
    <g:form method="post">
        <input type="hidden" name="id" value="${issue?.id}"/>
        <div class="dialog">
            <table>
                <tbody>
                    <tr class="prop">
                        <td valign="top" class="name">Id:</td>

                        <td valign="top" class="value">${issue}</td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">Project:</td>

                        <td valign="top" class="value"><g:link controller="project" action="show" id="${issue?.project?.id}">${issue?.project?.encodeAsHTML()}</g:link></td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="issueType">Type:</label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: issue, field: 'issueType', 'errors')}">
                            <g:select optionKey="id" from="${IssueType.list()}" name="issueType.id" value="${issue?.issueType?.id}"></g:select>
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="issueSeverity">Severity:</label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: issue, field: 'issueSeverity', 'errors')}">
                            <g:select optionKey="id" from="${IssueSeverity.list()}" name="issueSeverity.id" value="${issue?.issueSeverity?.id}"></g:select>
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="assignee">Assignee:</label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: issue, field: 'assignee', 'errors')}">
                            <g:select optionKey="id" from="${User.list()}" name="assignee.id" value="${issue?.assignee?.id}"></g:select>
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="summary">Summary:</label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: issue, field: 'summary', 'errors')}">
                            <input type="text" name="summary" id="summary" value="${fieldValue(bean: issue, field: 'summary')}"/>
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="description">Description:</label>
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: issue, field: 'description', 'errors')}">
                            <textarea name="description" id="description" rows="20" cols="30">${fieldValue(bean: issue, field: 'description')}</textarea>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="buttons">
            <span class="button"><g:actionSubmit class="save" value="Update"/></span>
            <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete"/></span>
        </div>
    </g:form>
</div>
</body>
</html>
